﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace _0812367_0912581
{
    public class GameLevel1: GameLevel
    {

        public GameLevel1(Game game, SpriteBatch theSpriteBatch)
            : base(game, theSpriteBatch)
        {
        }

        public override void LoadContent(ContentManager theContent)
        {
            base.LoadContent(theContent);

            //this.stateLevel = (int)StateLevel.Begin;

            //Player 
            this.playerMoney = this.PLAYERMONEY_BEGIN;
            this.nPlayerSprite = 2;
            playerSprite = new PlayerSprite[nPlayerSprite];
            listPlayerSpriteDraw = new List<PlayerSprite>();
            this.dx = Game.Window.ClientBounds.Width / 2 - 100;
            this.dy = 0;

            //public Plants(Texture2D aImage, Point aSheetsize, Vector2 thePosition, int theColOffset, float scale, int timePerFrame, int theTimeFireDelay, bool isLiving, Texture2D aBulletTexture, int theHp, bool AllowFire)
            playerSprite[0] = new PlayerSprite(playerTexture[0], new Point(4, 1), new Vector2(dx, dy), 20, 0.7f, 400, 800, true, playerBulletTexture[0], 200, true);
            dx += playerSprite[0].FrameSize.X * playerSprite[0].Scale;
            playerSprite[1] = new PlayerSprite(playerTexture[1], new Point(6, 1), new Vector2(dx, dy), 20, 0.7f, 200, 800, true, playerBulletTexture[0], 200, true);
            

            //Monter
            this.nMonterSprite = 2;
            this.TOTALMONTER = 20;
            this.remainMonterSprite = TOTALMONTER;
            this.NUMBER_MONTER_BEGIN = 4;
            this.numberMonterSpriteAtTime = this.NUMBER_MONTER_BEGIN;//se dc Update
            this.curNumberMonter = 0;
            this.monterSprite = new EnemySprite[nMonterSprite];
            this.listMonterSprite = new List<EnemySprite>();

            // public Monter(Texture2D aImage, Point aSheetsize, Vector2 thePosition, int theColOffset, float scale, int timePerFrame, Vector2 theSpeed, bool isLiving, Texture2D aBulletTexture, int theHp, bool AllowFire, int TimeFireDelay)
            monterSprite[0] = new EnemySprite(monterTexture[0], new Point(6, 1), new Vector2(Game.Window.ClientBounds.Width - 50, 50), 20, 1.0f, 50, new Vector2(1, 0), true, monterBulletTexture[0], 160, false, 1000);
            monterSprite[1] = new EnemySprite(monterTexture[1], new Point(4, 1), new Vector2(Game.Window.ClientBounds.Width - 50, 150), 20, 1.0f, 200, new Vector2(1, 0), true, monterBulletTexture[0], 160, false, 1000);

        }

        public override void Update(GameTime gameTime)
        {
            //for (int i = 0; i < nMonterSprite; i++)
            //{
            //    monterSprite[i].Update(gameTime);
            //}
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            //for (int i = 0; i < this.nPlayerSprite; i++)
            //{
            //    playerSprite[i].Draw(gameTime, this.spriteBatch);
            //}

            //for (int i = 0; i < nMonterSprite; i++)
            //{
            //    monterSprite[i].Draw(gameTime, this.spriteBatch);
            //}

            base.Draw(gameTime);
        }

        //public override void UpdateMonter(GameTime gameTime)
        //{
        //    base.UpdateMonter(gameTime);
        //}
        //public override void UpdateMonter(GameTime gameTime)
        //{
        //    base.UpdateMonter(gameTime);

        //}
    }
}
